#include<iostream>
#include<cstring>
using namespace std;

int n;  //货币种类
int m;  //兑换点数量
int s;  //持有第s种货币
double v;   //持有第s种货币的本金

int all;
double dis[101];

class exchange_points{
public:
    int a;
    int b;
    double r;
    double c;
}station[202];

bool bellman(void){
    memset(dis,0,sizeof(dis));
    dis[s]=v;

    bool flag;
    for(int i=1;i<=n-1;i++){
        flag=false;
        for(int j=0;j<all;j++){
            if(dis[station[j].b]<(dis[station[j].a]-station[j].c)*station[j].r)
            {
                dis[station[j].b]=(dis[station[j].a]-station[j].c)*station[j].r;
                flag=true;
            }
            if(!flag){
                break;
            }
        }
    }
    for(int i=0;i<all;i++){
        if(dis[station[i].b]<(dis[station[i].a]-station[i].c)*station[i].r)
        {
            return true;
        }
    }
    return false;
}

int main(void){
    int a,b;
    double Rab,Cab,Rba,Cba;
    while(cin>>n>>m>>s>>v){
        all=0;
        for(int i=0;i<m;i++){
            cin>>a>>b>>Rab>>Cab>>Rba>>Cba;
            station[all].a=a;
            station[all].b=b;
            station[all].r=Rab;
            station[all++].c=Cab;

            station[all].a=b;
            station[all].b=a;
            station[all].r=Rba;
            station[all++].c=Cba;
        }
        if(bellman())
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}